
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .ul1{
            display: flex;
        }
        .lis1{
            width: 70px;
            height: 50px;
            border: 1px solid black;
            list-style: none;
            line-height: 50px;
            text-align: center;
        }
        .lis2{
            width: 358px;
            height: 200px;
            text-align: center;
            line-height: 200px;
            border: 1px solid black;
            list-style: none;
            display: none;
        }
        #aa{
            background-color: cadetblue;
            color: white;
        }
        #bb{
            display: block;
        }
    </style>
</head>
<body>
    <ul class="ul1">
        <li class="lis1" id = 'aa'>军事</li>
        <li class="lis1">新闻</li>
        <li class="lis1">直播</li>
        <li class="lis1">游戏</li>
        <li class="lis1">生活</li>
    </ul>
    <ul class="ul2">
        <li class="lis2" id = "bb">歼20</li>
        <li class="lis2">新冠</li>
        <li class="lis2">联盟</li>
        <li class="lis2">王者</li>
        <li class="lis2">日常</li>
    </ul>
</body>
<script>
    /* 
        选项卡
            1.获取所有按钮
            2.获取所有对应的值
            3.给每个按钮绑定点击事件
            4.当点击按钮时 让当前的按钮选中
            5.让他的兄弟全部取消选中
            6.下边显示对应的内容
     */
    var lis1 = document.querySelectorAll('.lis1')
    var lis2 = document.querySelectorAll('.lis2')

    for (let i = 0; i < lis1.length; i++) {
        lis1[i].onclick = function(){
            for (let j = 0; j < lis1.length; j++) {
                lis1[j].id = ''
                lis2[j].id = ''
            }
            this.id = 'aa'
            lis2[i].id =  'bb'
        }
    }
</script>
</html>